//
//  NoDataView.m
//  fitnessmanage
//
//  Created by wujian on 2017/12/25.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "NoDataView.h"

static NoDataView *noDataView = nil;

@implementation NoDataView

+ (instancetype)shareInstance{
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        noDataView = [[NoDataView alloc] init];
    });
    
    return noDataView;
}

-(id)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        //self.backgroundColor = CSRedColor;
        
        UIImageView *imageView = [[UIImageView alloc] init];
        
        imageView.image = [UIImage imageNamed:@"img_nointroduction"];
        
        [self addSubview:imageView];
        
        self.imageView = imageView;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.center.mas_equalTo(self);
    }];
}


/**
 显示View
 */
- (void)showInView:(UIView *)view{
    
    [view insertSubview:self atIndex:0];
    
//    [view bringSubviewToFront:self];
    
    [self mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.mas_equalTo(view);
    }];
}

- (void)hideInView:(UIView *)view{
    
    [self removeFromSuperview];
}

@end
